class MusicPlayer(object):
    instance = None  # 用来保存对象

    def __new__(cls, *args, **kwargs):
        if cls.instance is None:
            cls.instance = super().__new__(cls)  # 类似于malloc
        return cls.instance

    def __init__(self, name):
        self.name = name


if __name__ == '__main__':
    player1 = MusicPlayer('七里香')
    player2 = MusicPlayer('东风破')
    # 地址是一样的
    print(id(player1))
    print(id(player2))
    # 名字都一样了，被覆盖
    print(player1.name)
    print(player2.name)
